#include <iostream>
#include <string>

using namespace std;

/*
1 -> "1"
10 -> "10"
100 -> "100"
1000 -> "1,000"
10000 -> "10,000"
100000 -> "100,000"
1000000 -> "1,000,000"
35235235 -> "35,235,235"
*/

void printFormattedNumber(int N) {
  int count = 0;
  string s;
  while(N) {
    if (count == 3) s = "," + s, count = 0;
    count++;
    s = "0"+s;
    s[0] += (N%10);
    N /= 10;
  }
  cout << s << endl;
}

int main()  {
  int i,j, k;
  int N;

  printFormattedNumber(1);
  printFormattedNumber(10);
  printFormattedNumber(100);
  printFormattedNumber(1000);
  printFormattedNumber(10000);
  printFormattedNumber(100000);
  printFormattedNumber(1000000);
  printFormattedNumber(35235235);

  return 0;
}
